//
//  WWManagedObject.h
//  Words2
//
//  Created by Mathieu on 11/07/06.
//  Copyright 2006 __MyCompanyName__. All rights reserved.
//
// Abstract: The NSManagedObject subclass used as a base-class for all of
// the entities in the Words model.  This is used to implement 
// custom methods to copy objects between stores.

#import <CoreData/CoreData.h>



@interface WWManagedObject : NSManagedObject {

}


// Returns a predicate to find an object that matches this one
- (NSPredicate *) predicateForSimilarObject;

	// Returns a managed object (or nil) that matches the current object from the specified stores
- (WWManagedObject *) similarObjectInContext: (NSManagedObjectContext *)context andStore:(id)store;

	// Returns a copy of this object (including attributes and relationships)
- (WWManagedObject *) copyToContext:(NSManagedObjectContext *)context andStore:(id)store;

	// Copies the attributes of the target object into this one
- (void) copyAttributesFromObject: (NSManagedObject *)managedObject;

	// Copies the to-one relationships from the target object to this one.  
	// If the useExisting flag is NO, a copy of the related object is made;  otherwise the existing value is related to this object
- (void) copyToOneRelationshipForKey: (NSString *)key fromObject: (NSManagedObject *)managedObject useExisting:(BOOL)useExisting;

	// Copies the to-many relationships from the target object to this one.  
	// If the useExisting flag is NO, a copy of the related object is made;  otherwise the existing value is related to this object
- (void) copyToManyRelationshipForKey: (NSString *)key fromObject: (NSManagedObject *)managedObject useExisting:(BOOL)useExisting;

- (void) addObject: (NSManagedObject *)object toToManyRelationshipForKey: (NSString *) key; 
//- (void) removeObject: (NSManagedObject *)object fromToManyRelationshipForKey: (NSString *) key; 

@end
